<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>添加陪护师信息</title>
</head>

<body>
<button id="addCaregiverBtn">修改陪护师信息</button>
<script>
    document.getElementById('addCaregiverBtn').addEventListener('click', async () => {
        const caregiverData = {
            caregiverid:1, // 比新增多了这个
            name: "张三",
            money: 200,
            phone: "13900139000",
            gender: 0,
            age: 28,
            jobnumber: "2024002",
            address: "上海市浦东新区",
            serviceyears: 3,
            biography: "有良好的沟通能力，服务态度好。",
            status: 1,
            avater: "https://example.com/avatar2.jpg",
            isok: 1
        };

        try {
            const response = await fetch('http://localhost:8000/updateCaregiver', {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json'
                },
                body: JSON.stringify(caregiverData)
            });

            const data = await response.json();
            if (response.ok) {
                console.log(data.message);
            } else {
                console.error(data.error);
            }
        } catch (error) {
            console.error('请求出错:', error);
        }
    });
</script>
</body>

</html>